package com.tanhua.server.controller;

import cn.hutool.core.convert.Convert;
import com.tanhua.common.utils.UserThreadLocal;
import com.tanhua.dubbo.api.UserLocationApi;
import com.tanhua.server.service.BaiduService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("baidu")
public class BaiduController {

    @Autowired
    private BaiduService baiduService;

    @PostMapping("location")
    public void updateLocation(@RequestBody Map<String,Object> param) {
        Double longitude = Convert.toDouble(param.get("longitude"));
        Double latitude = Convert.toDouble(param.get("latitude"));
        String address = Convert.toStr(param.get("addrStr"));
        this.baiduService.updateLocation(longitude, latitude, address);
    }
}
